home *** CD-ROM | disk | FTP | other *** search
- #ifndef MAXINT16
-
- /* Global definitions used by every source file.
- * Some may be compiler dependent.
- */
-
- #if (defined(LATTICE) || defined(MAC) || defined(__TURBOC__))
- /* These compilers require special open modes when reading binary files.
- *
- * "The single most brilliant design decision in all of UNIX was the
- * choice of a SINGLE character as the end-of-line indicator" -- M. O'Dell
- *
- * "Whoever picked the end-of-line conventions for MS-DOS and the Macintosh
- * should be shot!" -- P. Karn's corollary to O'Dells' declaration
- */
- #define READ_BINARY "rb"
- #define WRITE_BINARY "wb"
- #define READ_TEXT "rt"
- #define WRITE_TEXT "wt"
- #define APPEND_TEXT "at+"
-
- #else
-
- #define READ_BINARY "r"
- #define WRITE_BINARY "w"
- #define READ_TEXT "r"
- #define WRITE_TEXT "w"
- #define APPEND_TEXT "a+"
-
- #endif
-
-
- /* These two lines assume that your compiler's longs are 32 bits and
- * shorts are 16 bits. It is already assumed that chars are 8 bits,
- * but it doesn't matter if they're signed or unsigned.
- */
- typedef long int32; /* 32-bit signed integer */
- typedef unsigned short int16; /* 16-bit unsigned integer */
- #define uchar(x) ((unsigned char)(x))
- #define MAXINT16 65535 /* Largest 16-bit integer */
-
- #if (sizeof(int (*)()) == 4)
- #define LARGECODE 1
- #endif
-
- #if (sizeof(int *) == 4)
- #define LARGEDATA 1
- #endif
-
- /* Since not all compilers support structure assignment, the ASSIGN()
- * macro is used. This controls how it's actually implemented.
- */
- #ifdef NOSTRUCTASSIGN /* Version for old compilers that don't support it */
- #define ASSIGN(a,b) memcpy((char *)&(a),(char *)&(b),sizeof(b));
- #else /* Version for compilers that do */
- #define ASSIGN(a,b) ((a) = (b))
- #endif
-
- /* Define null object pointer in case stdio.h isn't included */
- #ifndef NULL
- /* General purpose NULL pointer */
- #define NULL (void *)0
- #endif
- #define NULLCHAR (char *)0 /* Null character pointer */
- #define NULLCHARP (char **)0 /* Null character pointer pointer */
- #define NULLINT (int *)0 /* Null integer pointer */
- #define NULLFP (int (*)())0 /* Null pointer to function returning int */
- #define NULLVFP (void (*)())0 /* Null pointer to function returning void */
- #define NULLVIFP (void interrupt (*)())0
- #define NULLFILE (FILE *)0 /* Null file pointer */
-
-
- #ifdef MPU8080 /* Assembler routines are available */
- int16 hinibble(),lonibble(),hibyte(),lobyte(),hiword(),loword();
-
- #else
-
- /* Extract a short from a long */
- #define hiword(x) ((int16)((x) >> 16))
- #define loword(x) ((int16)(x))
-
- /* Extract a byte from a short */
- #define hibyte(x) ((unsigned char)((x) >> 8))
- #define lobyte(x) ((unsigned char)(x))
-
- /* Extract nibbles from a byte */
- #define hinibble(x) (((x) >> 4) & 0xf)
- #define lonibble(x) ((x) & 0xf)
-
- #endif
-
- /* Local subroutines */
- #if defined(__STDC__) || defined (__TURBOC__)
-
- int htoi(char *);
- long htol(char *);
- void rip(char *);
- int dirps(void);
- void restore(int);
- long ptol(void *);
- #if !defined(__STDC__)
- long hptol(void huge *);
- #endif
- void *ltop(long);
- #if !defined(__TURBOC__)
- char *strdup(const char *);
- #endif
-
- #else
-
- int htoi();
- long htol();
- void rip();
- int dirps();
- void restore();
- long ptol();
- void *ltop();
- #if !defined(__TURBOC__)
- char *strdup();
- #endif
-
- #endif /* defined(__STDC__) || defined (__TURBOC__) */
-
- #include <stdlib.h>
- #include <string.h>
-
- #ifdef AZTEC
- #define rewind(fp) fseek(fp,0L,0);
- #endif
-
- #ifdef __TURBOC__
- #define movblock(so,ss,do,ds,c) movedata(ss,so,ds,do,c)
- #define outportw outport
- #define inportw inport
-
- #else
-
- /* General purpose function macros already defined in turbo C */
- #define min(x,y) ((x)<(y)?(x):(y)) /* Lesser of two args */
- #define max(x,y) ((x)>(y)?(x):(y)) /* Greater of two args */
- #define MK_FP(seg,ofs) ((void far *) \
- (((unsigned long)(seg) << 16) | (unsigned)(ofs)))
- #endif /* defined(__TURBOC __) */
-
- #endif /* MAXINT16 */
-
-